package com.bringway.p2p.constant;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import net.sf.json.JSONException;
import net.sf.json.JSONObject;

public class ExcelHeadConstant {
	
	/**
	 * 充值数据
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getCzExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "商户号", "订单号", "充值金额", "充值时间", "红点e贷用户名", "手机号码", "客户姓名", "客户身份证号码", "客户推荐人注册码"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("SHH");
			lineData[1] = jsObj.optString("DDH");
			lineData[2] = jsObj.optString("CZJE");
			lineData[3] = jsObj.optString("CZSJ");
			lineData[4] = jsObj.optString("GYH");
			lineData[5] = jsObj.optString("SJHM");
			lineData[6] = jsObj.optString("REAL_NAME");
			lineData[7] = jsObj.optString("SFZ_NUM");
			lineData[8] = jsObj.optString("TJR");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	/**
	 * 投资人信息
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getTzrxxExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名", "手机号码", "推荐人工号", "项目名称","年化率(%)", "期限(天)","期限(月)", "项目类型","还款类型", "投资金额", "投资时间", "投资状态","合同编号"
				,"散标类预计计息日期"
				,"OA员工地区","OA员工部门","OA员工所属","OA员工职务","OA员工职级","OA姓名","OA员工手机号码","推荐级别"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USERID");
			lineData[1] = jsObj.optString("SJHM");
			lineData[2] = jsObj.optString("TJR");
			lineData[3] = jsObj.optString("XMMC");
			lineData[4] = jsObj.optString("SJSYL");
			lineData[5] = jsObj.optString("QX");
			lineData[6] = jsObj.optString("QX_MONTH");
			if("01".equals(lineData[6])){
				lineData[6] = "一个月";
			}else if("02".equals(lineData[6])){
				lineData[6] = "两个月";
			}else if("03".equals(lineData[6])){
				lineData[6] = "三个月";
			}else if("04".equals(lineData[6])){
				lineData[6] = "四个月";
			}else if("05".equals(lineData[6])){
				lineData[6] = "五个月";
			}else if("06".equals(lineData[6])){
				lineData[6] = "六个月";
			}else if("07".equals(lineData[6])){
				lineData[6] = "七个月";
			}else if("08".equals(lineData[6])){
				lineData[6] = "八个月";
			}else if("09".equals(lineData[6])){
				lineData[6] = "九个月";
			}else if("10".equals(lineData[6])){
				lineData[6] = "十个月";
			}else if("11".equals(lineData[6])){
				lineData[6] = "十一个月";
			}else if("12".equals(lineData[6])){
				lineData[6] = "一年";
			}else if("18".equals(lineData[6])){
				lineData[6] = "一年半";
			}else if("24".equals(lineData[6])){
				lineData[6] = "两年";
			}
			lineData[7] = jsObj.optString("XM_TYPE");
			if("01".equals(lineData[7]) ){
				lineData[7] = "债权转让";
			}else if("02".equals(lineData[7]) ){
				lineData[7] = "散标投资";
			}
			lineData[8] = jsObj.optString("HK_TYPE");
			if("01".equals(lineData[8]) ){
				lineData[8] = "到期本息还款";
			}else if("02".equals(lineData[8]) ){
				lineData[8] = "月付收益，到期还本";
			}
			lineData[9] = jsObj.optString("TCJE");
			lineData[10] = jsObj.optString("TZSJ");
			lineData[11] = jsObj.optString("TCZT");
			lineData[12] = jsObj.optString("HTBH");
			lineData[13] = jsObj.optString("JXRQ");
			if("债权转让".equals(lineData[7]) ){//债权转让不显示,散标投资显示
				lineData[13] = "";
			}
			
			lineData[14] = jsObj.optString("DQ");
			lineData[15] = jsObj.optString("BM");
			lineData[16] = jsObj.optString("SS");
			lineData[17] = jsObj.optString("ZW");
			lineData[18] = jsObj.optString("ZJ");
			lineData[19] = jsObj.optString("OA_XM");
			lineData[20] = jsObj.optString("OA_SJHM");
			lineData[21] = jsObj.optString("KHDJ");
			if("01".equals(lineData[21]) ){
				lineData[21] = "一级";
			}else if("02".equals(lineData[21]) ){
				lineData[21] = "二级";
			}else if("03".equals(lineData[21]) ){
				lineData[21] = "三级";
			}
			resultList.add(lineData);
		}
		return resultList;
	}
	
	/**
	 * 红包数据
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getHbExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名", "红包金额(元)", "手机号码", "发放日期", "红包有效天数", "过期时间", "红包状态", "红包使用最小金额", "红包使用时间"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_ID");
			lineData[1] = jsObj.optString("HB_JE");
			lineData[2] = jsObj.optString("USER_ID_LXFS");
			lineData[3] = jsObj.optString("HB_CREATE_DATE");
			lineData[4] = jsObj.optString("HB_EFFECTIVE_DAYS");
			lineData[5] = jsObj.optString("HB_OVER_DATE");
			lineData[6] = jsObj.optString("HB_STATE");
			if("0".equals(lineData[6])){
				lineData[6] = "未使用";
			}else if("1".equals(lineData[6])){
				lineData[6] = "已使用";
			}else if("2".equals(lineData[6])){
				lineData[6] = "已过期";
			}
			lineData[7] = jsObj.optString("HB_USE_CONDITION_MIN_JE");
			lineData[8] = jsObj.optString("HB_USE_DATE");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	
	/**
	 * 注册信息推荐人信息导出
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getTjrExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名", "手机号码", "推荐人(员工号)","推广码","推荐人推广码","推荐级别", "真实姓名", "身份证号码", "注册日期", "OA员工地区", "OA员工部门"
				, "OA员工所属", "OA员工职务", "OA员工职级", "OA姓名", "OA员工手机号码"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("SJHM");
			lineData[2] = jsObj.optString("TJR");
			lineData[3] = jsObj.optString("TGCODE");
			lineData[4] = jsObj.optString("TJR_TGCODE");
			lineData[5] = jsObj.optString("TJJB");
			lineData[6] = jsObj.optString("REAL_NAME");
			lineData[7] = jsObj.optString("SFZ_NUM");
			lineData[8] = jsObj.optString("CJRQ");
			lineData[9] = jsObj.optString("DQ");
			lineData[10] = jsObj.optString("BM");
			lineData[11] = jsObj.optString("SS");
			lineData[12] = jsObj.optString("ZW");
			lineData[13] = jsObj.optString("ZJ");
			lineData[14] = jsObj.optString("OA_XM");
			lineData[15] = jsObj.optString("OA_SJHM");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * 注册信息信息导出
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getZcxxExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名", "手机号码", "真实姓名", "身份证号码", "注册日期","注册类型", "推荐人(员工号)","推荐级别", "OA员工地区", "OA员工部门"
				, "OA员工所属", "OA员工职务", "OA员工职级", "OA姓名", "OA员工手机号码","推广码"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("SJHM");
			lineData[2] = jsObj.optString("REAL_NAME");
			lineData[3] = jsObj.optString("SFZ_NUM");
			lineData[4] = jsObj.optString("CJRQ");
			lineData[5] = jsObj.optString("CJ_TYPE");
			lineData[6] = jsObj.optString("TJR");
			lineData[7] = jsObj.optString("TJJB");
			if ("01".equals(lineData[7])) {
				lineData[7] ="一级";
			}else if ("02".equals(lineData[7])) {
				lineData[7] ="二级";
			}else if ("03".equals(lineData[7])) {
				lineData[7] ="三级";
			}else {
				lineData[7] ="";
			}
			lineData[8] = jsObj.optString("DQ");
			lineData[9] = jsObj.optString("BM");
			lineData[10] = jsObj.optString("SS");
			lineData[11] = jsObj.optString("ZW");
			lineData[12] = jsObj.optString("ZJ");
			lineData[13] = jsObj.optString("OA_XM");
			lineData[14] = jsObj.optString("OA_SJHM");
			lineData[15] = jsObj.optString("TGM");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	/**
	 * 导出业务员所属推荐统计excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getYwysstjExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "推荐人(员工号)", "推荐人数", "推荐客户入金（元）"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("TJR");
			lineData[1] = jsObj.optString("TJR_CT");
			lineData[2] = jsObj.optString("TJR_S_TZJE");
			if(StringUtils.isNotEmpty(lineData[2]) && "null".equals(lineData[2])){
				lineData[2] = "0";
			}
			resultList.add(lineData);
		}
		return resultList;
	}
	
	
	
	
	/**
	 *系统信息
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getYcExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "系统事件名", "对应事件", "系统信息", "事件日期"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("LOG_TYPE");
			lineData[2] = jsObj.optString("LOG_CONTENT");
			lineData[3] = jsObj.optString("LOG_DATE");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	/**
	 * 单笔收益发放
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */
	public static List<String[]> getDbsyExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "客户用户名", "手机号码", "项目编号", "项目名称", "单笔收益金额(元)", "发放时间", "推荐人注册码","是否转让专区"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("SJHM");
			lineData[2] = jsObj.optString("ZQ_ID");
			lineData[3] = jsObj.optString("XMMC");
			lineData[4] = jsObj.optString("DB_HK_SYJE");
			lineData[5] = jsObj.optString("DB_HK_DATE");
			lineData[6] = jsObj.optString("TJR");
			lineData[7] = jsObj.optString("IS_ZRZQ");
			if (StringUtils.equals("01", lineData[7])) {
				lineData[7]="是";
			} else{
				lineData[7]="否";
			}
			resultList.add(lineData);
		}
		return resultList;
	}
	
	
	/**
	 * 计划内投资人信息
	 * 附件信息导出excel
	 * 将查询结果转为导出Excel时需要的格式
	 * @param nodeArray 查询结果
	 * @return 转换结果
	 * @throws JSONException
	 */

	public static List<String[]> getJhntzxiExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名",  "计划内项目编号", "投资金额","投资时间", "投资状态","还款状态", "计息日期","投资收益", "合同编号","OA员工地区","OA员工部门","OA员工所属","OA员工职务","OA员工职级","OA姓名","OA员工手机号码", };
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USERID");
			lineData[1] = jsObj.optString("REF_XM_ORDER");
			lineData[2] = jsObj.optString("TZJE");
			lineData[3] = jsObj.optString("TZSJ");
			lineData[4] = jsObj.optString("TZZT");
			if("00".equals(lineData[4]) ){
				lineData[4] = "成功";
			}else if("01".equals(lineData[4]) ){
				lineData[4] = "失败";
			}else if("02".equals(lineData[4]) ){
				lineData[4] = "撤销投资";
			}
			lineData[5] = jsObj.optString("HKZT");
			if("0".equals(lineData[5]) ){
				lineData[5] = "没到计息期";
			}else if("1".equals(lineData[5]) ){
				lineData[5] = "到计息期";
			}else if("2".equals(lineData[5]) ){
				lineData[5] = "到期还款，还款中";
			}else if("3".equals(lineData[5]) ){
				lineData[5] = "还款已到账";
			}
			lineData[6] = jsObj.optString("JXRQ");
			lineData[7] = jsObj.optString("TZSY");
			lineData[8] = jsObj.optString("HTBH");
			lineData[9] = jsObj.optString("DQ");
			lineData[10] = jsObj.optString("BM");
			lineData[11] = jsObj.optString("SS");
			lineData[12] = jsObj.optString("ZW");
			lineData[13] = jsObj.optString("ZJ");
			lineData[14] = jsObj.optString("XM");
			lineData[15] = jsObj.optString("SJHM");
			resultList.add(lineData);
		}
		return resultList;
	}
	

	public static List<String[]> getVipCzExportSearchResultData(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名",  "充值时间", "手机号码","推荐人"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USERNAME");
			lineData[1] = jsObj.optString("CZSJ");
			lineData[2] = jsObj.optString("SJHM");
			lineData[3] = jsObj.optString("TJR");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 getAppLoadExportSearchResultData  
	 * @功能 TODO App首次登录数据下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getAppLoadExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "首次登录时间",  "登录所在城市", "设备类型","设备型号","用户名","推荐人(员工号)","推荐级别","OA员工号码","OA员工地区","OA员工部门","OA员工所属","OA员工职务","OA员工职级","OA姓名","OA手机号码"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("MINOPEN");
			lineData[1] = jsObj.optString("DEVICE_CITY_CODE");
			lineData[2] = jsObj.optString("DEVICE_TYPE");
			if ("0".contains(lineData[2])) {
				lineData[2]="Android";
			} else {
				lineData[2]="ios";
			}
			lineData[3] = jsObj.optString("DEVICE_MODULE_CODE");
			lineData[4] = jsObj.optString("USER_NAME");
			lineData[5] = jsObj.optString("TJR");
			lineData[6] = jsObj.optString("KHDJ");
			if ("01".equals(lineData[6])) {
				lineData[6] ="一级";
			} else if ("02".equals(lineData[6])) {
				lineData[6] ="二级";
			}  else if ("03".equals(lineData[6])) {
				lineData[6] ="三级";
			} 
			lineData[7] = jsObj.optString("OA_GYH");
			lineData[8] = jsObj.optString("DQ");
			lineData[9] = jsObj.optString("BM");
			lineData[10] = jsObj.optString("SS");
			lineData[11] = jsObj.optString("ZW");
			lineData[12] = jsObj.optString("ZJ");
			lineData[13] = jsObj.optString("OA_XM");
			lineData[14] = jsObj.optString("OA_SJHM");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 getAppLoginiTjExportSearchResultData  
	 * @功能 TODO app首次登陆地区统计
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getAppLoginiTjExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "客户归属地区","首次登陆人数"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("DQ");
			if ("null".equals(lineData[0])) {
				lineData[0]="无归属";
			}
			lineData[1] = jsObj.optString("DLSL");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 getOrderExportSearchResultData  
	 * @功能 TODO 点券商城订单查询
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getOrderExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","订单号","配送方式","订单金额","订单状态","买家留言","创建订单时间","推荐人(员工号)","推荐级别","推荐人所在公司","办理签收人","办理签收时间","购买的商品","付款时间"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("ORDER_BH");
			lineData[2] = jsObj.optString("ZF_TYPE");
			if ("01".equals(lineData[2])) {
				lineData[2]="定点取货";
			} else if ("02".equals(lineData[2])){
				lineData[2]="快递发送";
			}
			lineData[3] = jsObj.optString("REAL_JE");
			lineData[4] = jsObj.optString("ORDER_STATE");
			if ("00".equals(lineData[4])) {
				lineData[4] ="等待付款";
			} else if ("01".equals(lineData[4])){
				lineData[4] ="支付完成";
			} else if ("02".equals(lineData[4])){
				lineData[4] ="交易完成";
			} else if ("03".equals(lineData[4])){
				lineData[4] ="取消的订单";
			}
			lineData[5] = jsObj.optString("MESSAGE");
			lineData[6] = jsObj.optString("CREATE_DATE");
			lineData[7] = jsObj.optString("TJR");
			lineData[8] = jsObj.optString("TJDJ");
			if ("01".equals(lineData[8])){
				lineData[8] ="一级";
			} else if ("02".equals(lineData[8])){
				lineData[8] ="二级";
			} else if ("03".equals(lineData[8])){
				lineData[8] ="三级";
			}
			lineData[9] = jsObj.optString("DQ");
			lineData[10] = jsObj.optString("QSR_USER_NAME");
			lineData[11] = jsObj.optString("QS_DATE");
			lineData[12] = jsObj.optString("PROXX");
			lineData[13] = jsObj.optString("FKSJ");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	
	/**
	 * @作者 js  
	 * @方法名 getOrderExportSearchResultData1  
	 * @功能 TODO 点券商城订单查询
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getOrderExportSearchResultData1(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","订单号","配送方式","订单金额","订单状态","买家留言","创建订单时间","推荐人(员工号)","推荐级别","推荐人所在公司","办理签收人","办理签收时间","商品名称","商品数量","商品单价","商品合计金额","付款时间"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("ORDER_BH");
			lineData[2] = jsObj.optString("ZF_TYPE");
			if ("01".equals(lineData[2])) {
				lineData[2]="定点取货";
			} else if ("02".equals(lineData[2])){
				lineData[2]="快递发送";
			}
			lineData[3] = jsObj.optString("REAL_JE");
			lineData[4] = jsObj.optString("ORDER_STATE");
			if ("00".equals(lineData[4])) {
				lineData[4] ="等待付款";
			} else if ("01".equals(lineData[4])){
				lineData[4] ="支付完成";
			} else if ("02".equals(lineData[4])){
				lineData[4] ="交易完成";
			} else if ("03".equals(lineData[4])){
				lineData[4] ="取消的订单";
			}
			lineData[5] = jsObj.optString("MESSAGE");
			lineData[6] = jsObj.optString("CREATE_DATE");
			lineData[7] = jsObj.optString("TJR");
			lineData[8] = jsObj.optString("TJDJ");
			if ("01".equals(lineData[8])){
				lineData[8] ="一级";
			} else if ("02".equals(lineData[8])){
				lineData[8] ="二级";
			} else if ("03".equals(lineData[8])){
				lineData[8] ="三级";
			}
			lineData[9] = jsObj.optString("DQ");
			lineData[10] = jsObj.optString("QSR_USER_NAME");
			lineData[11] = jsObj.optString("QS_DATE");
			lineData[12] = jsObj.optString("PRODUCT_NAME");
			lineData[13] = jsObj.optString("PRODUCT_NUM");
			lineData[14] = jsObj.optString("PRODUCT_DJ_JE");
			lineData[15] = jsObj.optString("PRODUCT_HJ_JE");
			lineData[16] = jsObj.optString("FKSJ");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	/**
	 * @作者 js  
	 * @方法名 getDqbdExportSearchResultData  
	 * @功能 TODO 点券变动明细下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getDqbdExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","手机号码","变动类型","变动时间","变动点券金额","发生额","点券原始金额","点券最终金额"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("SJHM");
			lineData[2] = jsObj.optString("CHANGE_TYPE");
			if ("1001".equals(lineData[2])) {
				lineData[2]="推荐注册";
			} else if ("1002".equals(lineData[2])){
				lineData[2]="推荐投资";
			} else if ("1003".equals(lineData[2])){
				lineData[2]="商城购物消费";
			}
			lineData[3] = jsObj.optString("CHANGE_DATE");
			lineData[4] = jsObj.optString("CHANGE_DQ_JE");
			lineData[5] = jsObj.optString("OCCUR_JE");
			lineData[6] = jsObj.optString("DQ_ORIGINAL_JE");
			lineData[7] = jsObj.optString("DQ_FINAL_JE");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 getDqtzxiExportSearchResultData  
	 * @功能 TODO 点券来源下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getDqtzxiExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","手机号码","点券获取来源","来源发生时间","被推荐人用户名","奖励点券金额","备注"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("SJHM");
			lineData[2] = jsObj.optString("LY_TYPE");
			if ("01".equals(lineData[2])) {
				lineData[2]="推荐注册";
			} else if ("02".equals(lineData[2])){
				lineData[2]="推荐投资";
			}
			lineData[3] = jsObj.optString("LY_DATE");
			lineData[4] = jsObj.optString("LY_TJ_USER_NAME");
			lineData[5] = jsObj.optString("DQ_JE");
			lineData[6] = jsObj.optString("NOTE");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 getCjZjExportSearchResultData  
	 * @功能 TODO 年会抽奖中奖信息下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getCjZjExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "员工号","姓名","人员岗位信息","性别","是否中奖","中奖等级","中奖时间"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("GYH");
			lineData[1] = jsObj.optString("REAL_NAME");
			lineData[2] = jsObj.optString("RYGW");
			lineData[3] = jsObj.optString("XB");
			if ("01".equals(lineData[3])) {
				lineData[3]="男";
			} else if ("00".equals(lineData[3])){
				lineData[3]="女";
			}
			lineData[4] = jsObj.optString("IS_ZJ");
			if ("1".equals(lineData[4])) {
				lineData[4]="中奖";
			} else{
				lineData[4]="未中奖";
			}
			lineData[5] = jsObj.optString("ZJ_LEVEL");
			if ("LEVEL_1".equals(lineData[5])) {
				lineData[5]="一等奖";
			} else if ("LEVEL_2".equals(lineData[5])){
				lineData[5]="二等奖";
			} else if ("LEVEL_3".equals(lineData[5])){
				lineData[5]="三等奖";
			}
			lineData[6] = jsObj.optString("ZJ_DATE");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 exportTjbbDayExcelMethod  
	 * @功能 TODO 日报表下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> exportTjbbDayExcelMethod(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "公司名称","门店名称","当日投标原值","当日年化原值","本月投标原值合计","本月年化原值合计","红包抵用","当日净投标","当日净年化","当月净投标合计","当月净年化合计"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("GSMC");
			lineData[1] = jsObj.optString("MDMC");
			lineData[2] = jsObj.optString("TBYZ");
			lineData[3] = jsObj.optString("NHYZ");
			lineData[4] = jsObj.optString("TBYZ_M");
			lineData[5] = jsObj.optString("NHYZ_M");
			lineData[6] = jsObj.optString("HBDY");
			lineData[7] = jsObj.optString("JTBZ");
			lineData[8] = jsObj.optString("JNHZ");
			lineData[9] = jsObj.optString("JTBZ_M");
			lineData[10] = jsObj.optString("JNHZ_M");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 exportTjbbMonthExcelMethod  
	 * @功能 TODO 月报表下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> exportTjbbMonthExcelMethod(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "公司名称","门店名称","投标原值","年化原值","红包抵用","净投标","净年化","客户充值额","银盛确认额","通联确认额","充值核对","提现","提现手续费","提现支出合计","注册人数"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("GSMC");
			lineData[1] = jsObj.optString("MDMC");
			lineData[2] = jsObj.optString("TBYZ");
			lineData[3] = jsObj.optString("NHYZ");
			lineData[4] = jsObj.optString("HBDY");
			lineData[5] = jsObj.optString("JTBZ");
			lineData[6] = jsObj.optString("JNHZ");
			lineData[7] = jsObj.optString("KHCZE");
			lineData[8] = jsObj.optString("YSQRE");
			lineData[9] = jsObj.optString("TLQRE");
			lineData[10] = jsObj.optString("CZHD");
			lineData[11] = jsObj.optString("TX");
			lineData[12] = jsObj.optString("TXSXF");
			lineData[13] = jsObj.optString("TXZCHJ");
			lineData[14] = jsObj.optString("ZC");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 js  
	 * @方法名 getZnqCjExportSearchResultData  
	 * @功能 TODO 周年庆抽奖下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> getZnqCjExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","姓名","手机号码","推荐人(员工号)","推荐级别","中奖类型","奖项","中奖时间","领取状态","领取门店","用户备注","用户操作时间","发放人(员工号)","发放备注","发放时间","抽奖来源端口"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USERNAME");
			lineData[1] = jsObj.optString("REAL_NAME");
			lineData[2] = jsObj.optString("SJHM");
			lineData[3] = jsObj.optString("TJR");
			lineData[4] = jsObj.optString("TJJB");
			if ("1".equals(lineData[4])) {
				lineData[4]="一级";
			} else if("2".equals(lineData[4])){
				lineData[4]="二级";
			} else if("3".equals(lineData[4])){
				lineData[4]="三级";
			}
			lineData[5] = jsObj.optString("CJ_TYPE");
			if ("01".equals(lineData[5])) {
				lineData[5]="VIP注册抽奖";
			} else if ("02".equals(lineData[5])){
				lineData[5]="周年庆抽奖";
			}
			lineData[6] = jsObj.optString("JX");
			if ("1".equals(lineData[6])) {
				lineData[6]="iPhone7一部";
			} else if("2".equals(lineData[6])){
				lineData[6]="梦缘Ⅲ号酒两瓶";
			} else if("3".equals(lineData[6])){
				lineData[6]="稻花香大米一袋";
			} else if("4".equals(lineData[6])){
				lineData[6]="晶鳯鸡蛋30枚";
			} else if("5".equals(lineData[6])){
				lineData[6]="红包20元";
			} else if("6".equals(lineData[6])){
				lineData[6]="红包5元";
			}
			lineData[7] = jsObj.optString("CJSJ");
			lineData[8] = jsObj.optString("LQ_STATE");
			if ("00".equals(lineData[8])) {
				lineData[8]="未领取";
			} else if("01".equals(lineData[8])){
				lineData[8]="领取中";
			} else if("02".equals(lineData[8])){
				lineData[8]="已领取";
			}
			lineData[9] = jsObj.optString("LQ_FGSMD");
			lineData[10] = jsObj.optString("USER_COMMENT");
			lineData[11] = jsObj.optString("USER_CZSJ");
			lineData[12] = jsObj.optString("FF_GYH");
			lineData[13] = jsObj.optString("FF_COMMENT");
			lineData[14] = jsObj.optString("FFSJ");
			lineData[15] = jsObj.optString("LY_TYPE");
			if ("00".equals(lineData[15])) {
				lineData[15]="网页端";
			} else if("01".equals(lineData[15])){
				lineData[15]="苹果APP端";
			} else if("02".equals(lineData[15])){
				lineData[15]="安卓APP端";
			}
			resultList.add(lineData);
		}
		return resultList;
	}
	public static List<String[]> getYhkmxExportSearchResultData(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "项目ID","代发人(手机号)","项目名称","项目类型","发布时间","总期数","本次属期","计息日期","应还收益日期","发标金额","募集金额","年化收益率","应还本金","应还收益","合计"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("ZQ_ID");
			lineData[1] = jsObj.optString("DFRID");
			lineData[2] = jsObj.optString("XMMC");
			lineData[3] = jsObj.optString("XM_TYPE");
			if ("01".equals(lineData[3])) {
				lineData[3]="债权转让";
			} else if ("02".equals(lineData[3])) {
				lineData[3]="散标投资";
			}
			lineData[4] = jsObj.optString("FBSJ");
			lineData[5] = jsObj.optString("QX_MONTH");
			lineData[6] = jsObj.optString("SSQS");
			lineData[7] = jsObj.optString("JXRQ");
			lineData[8] = jsObj.optString("YHLX_DATE");
			lineData[9] = jsObj.optString("JE");
			lineData[10] = jsObj.optString("ZQ_MJJE");
			lineData[11] = jsObj.optString("SJSYL");
			lineData[12] = jsObj.optString("YHBJ");
			lineData[13] = jsObj.optString("YHLX");
			lineData[14] = jsObj.optString("HJ");
			resultList.add(lineData);
		}
		return resultList;
	}
	public static List<String[]> exportsyffmxExcelMethod(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","项目来源类型","项目ID","投资人信息ID","投资金额","投资时间","回款收益金额","回款日期","回款状态","还款类型","还款所属期数"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USER_NAME");
			lineData[1] = jsObj.optString("XM_LY_TYPE");
			if ("00".equals(lineData[1])) {
				lineData[1]="Hplan计划";
			}
			lineData[2] = jsObj.optString("REF_XM_ID");
			lineData[3] = jsObj.optString("REF_TZRXX_ID");
			lineData[4] = jsObj.optString("TZJE");
			lineData[5] = jsObj.optString("TZSJ");
			lineData[6] = jsObj.optString("DB_HK_SYJE");
			lineData[7] = jsObj.optString("DB_HK_DATE");
			lineData[8] = jsObj.optString("DB_HK_STATE");
			if ("00".equals(lineData[8])) {
				lineData[8]="未知";
			}else if ("01".equals(lineData[8])) {
				lineData[8]="成功";
			}else if ("02".equals(lineData[8])) {
				lineData[8]="失败";
			}
			lineData[9] = jsObj.optString("DB_HK_TYPE");
			if ("01".equals(lineData[9])) {
				lineData[9]="收益";
			}else if ("02".equals(lineData[9])) {
				lineData[9]="本金";
			}
			lineData[10] = jsObj.optString("DB_HK_SSQS");
			resultList.add(lineData);
		}
		return resultList;
	}
	
	
	public static List<String[]> exportHhkExcelMethod(List<Map<String, Object>> list)
			throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "所属债权ID",  "所属期数", "应还利息时间","应还本金", "应还利息","还款项目类型", "H计划项目ID","项目名称", "借款人用户名","还款期数状态","还款逾期天数","还款逾期金额","还款日期","还款明细表ID" };
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("REF_ZQ_ID");
			lineData[1] = jsObj.optString("SSQS");
			lineData[2] = jsObj.optString("YHLX_DATE");
			lineData[3] = jsObj.optString("YHBJ");
			lineData[4] = jsObj.optString("YHLX");
			lineData[5] = jsObj.optString("YHK_XM_TYPE");
			if("01".equals(lineData[5]) ){
				lineData[5] = "红点宝";
			}else if("02".equals(lineData[5]) ){
				lineData[5] = "H计划";
			}
			lineData[6] = jsObj.optString("REF_XM_ID");
			lineData[7] = jsObj.optString("REF_XM_NAME");
			lineData[8] = jsObj.optString("REF_JKR_USERNAME");
			lineData[9] = jsObj.optString("YHK_QS_STATE");
			if("1001".equals(lineData[9]) ){
				lineData[9] = "待还款，未到还款日";
			}else if("1002".equals(lineData[9]) ){
				lineData[9] = "逾期，未还款";
			}else if("2001".equals(lineData[9]) ){
				lineData[9] = "已还款，正常";
			}else if("2002".equals(lineData[9]) ){
				lineData[9] = "已还款，逾期";
			}
			lineData[10] = jsObj.optString("YHK_YQ_TS");
			lineData[11] = jsObj.optString("YHK_YQ_JE");
			lineData[12] = jsObj.optString("HK_DATE");
			lineData[13] = jsObj.optString("REF_HK_ID");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 qjy  
	 * @方法名 exportHtzjlExcelMethod  
	 * @功能 TODO  H组合计划项目投资记录下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> exportHtzjlExcelMethod(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","项目来源类型","关联的项目ID","投资金额","投资时间","状态","还款状态","计息日期","投资收益","合同编号","上一次发放收益日期"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USERID");
			lineData[1] = jsObj.optString("XM_LY_TYPE");
			if ("00".equals(lineData[1])) {
				lineData[1]="Hplan计划";
			} 
			lineData[2] = jsObj.optString("REF_H_PLAN_XM_ID");
			lineData[3] = jsObj.optString("TZJE");
			lineData[4] = jsObj.optString("TZSJ");
			lineData[5] = jsObj.optString("TZZT");
			if ("00".equals(lineData[5])) {
				lineData[5]="成功";
			} else if ("01".equals(lineData[5])) {
				lineData[5]="失败";
			}  else if ("02".equals(lineData[5])) {
				lineData[5]="撤销投资";
			}
			lineData[6] = jsObj.optString("HKZT");
			if ("0".equals(lineData[6])) {
				lineData[6]="没到计息期";
			}else if ("1".equals(lineData[6])) {
				lineData[6]="到计息期";
			}else if ("2".equals(lineData[6])) {
				lineData[6]="还款中";
			}else if ("3".equals(lineData[6])) {
				lineData[6]="还款已到账";
			}
			lineData[7] = jsObj.optString("JXRQ");
			lineData[8] = jsObj.optString("TZSY");
			lineData[9] = jsObj.optString("HTBH");
			lineData[10] = jsObj.optString("LAST_FF_SYRQ");
			resultList.add(lineData);
		}
		return resultList;
	}
	/**
	 * @作者 qjy  
	 * @方法名 exportHtzjlExcelMethod  
	 * @功能 TODO  H组合计划项目流标投资记录下载
	 * @param list
	 * @return
	 * @throws JSONException
	 */
	public static List<String[]> exportHlbtzjlExcelMethod(List<Map<String, Object>> list) throws JSONException{
		List<String[]> resultList = new ArrayList<String[]>();
		String[] header = { "用户名","项目来源类型","关联的项目ID","投资金额","投资时间","投资状态","还款状态","计息日期","投资收益","合同编号","上一次发放收益日期","备份时间"};
		resultList.add(header);
		String[] lineData = null;
		JSONObject jsObj = null;
		for (int i = 0; i < list.size(); i++) {
			lineData = new String[header.length];
			Map<String, Object> map = list.get(i);
			jsObj  = JSONObject.fromObject(map);
			lineData[0] = jsObj.optString("USERID");
			lineData[1] = jsObj.optString("XM_LY_TYPE");
			if ("00".equals(lineData[1])) {
				lineData[1]="Hplan计划";
			} 
			lineData[2] = jsObj.optString("REF_H_PLAN_XM_ID");
			lineData[3] = jsObj.optString("TZJE");
			lineData[4] = jsObj.optString("TZSJ");
			lineData[5] = jsObj.optString("TZZT");
			if ("00".equals(lineData[5])) {
				lineData[5]="成功";
			} else if ("01".equals(lineData[5])) {
				lineData[5]="失败";
			}  else if ("02".equals(lineData[5])) {
				lineData[5]="撤销投资";
			}
			lineData[6] = jsObj.optString("HKZT");
			if ("0".equals(lineData[6])) {
				lineData[6]="没到计息期";
			}else if ("1".equals(lineData[6])) {
				lineData[6]="到计息期";
			}else if ("2".equals(lineData[6])) {
				lineData[6]="还款中";
			}else if ("3".equals(lineData[6])) {
				lineData[6]="还款已到账";
			}
			lineData[7] = jsObj.optString("JXRQ");
			lineData[8] = jsObj.optString("TZSY");
			lineData[9] = jsObj.optString("HTBH");
			lineData[10] = jsObj.optString("LAST_FF_SYRQ");
			lineData[11] = jsObj.optString("BK_DATE");
			resultList.add(lineData);
		}
		return resultList;
	}
}
